Total Complexity | 2 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { |
||
20 | |||
21 | @Controller('schools') |
||
22 | @ApiTags('School') |
||
23 | @ApiBearerAuth() |
||
24 | @UseGuards(AuthGuard('bearer'), RolesGuard) |
||
25 | export class GetSchoolAction { |
||
26 | constructor( |
||
27 | @Inject('IQueryBus') |
||
28 | private readonly queryBus: IQueryBus |
||
29 | ) {} |
||
30 | |||
31 | @Get(':id') |
||
32 | @Roles(UserRole.PHOTOGRAPHER, UserRole.DIRECTOR) |
||
33 | @ApiOperation({ summary: 'Get school' }) |
||
34 | public async index( |
||
35 | @Param() dto: IdDTO, |
||
36 | @LoggedUser() { id }: UserAuthView |
||
37 | ): Promise<SchoolView> { |
||
38 | try { |
||
39 | return await this.queryBus.execute(new GetSchoolByIdQuery(dto.id, id)); |
||
40 | } catch (e) { |
||
41 | throw new NotFoundException(e.message); |
||
42 | } |
||
45 |